def is_prime(num):
    """检查一个数是否是质数"""
    if num <= 1:
        return False
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    for i in range(3, int(num ** 0.5) + 1, 2):
        if num % i == 0:
            return False
    return True


def find_primes_up_to(n):
    """找到所有小于等于n的质数"""
    primes = []
    for num in range(2, n + 1):
        if is_prime(num):
            primes.append(num)
            print(num)
    return primes


# 示例：找到所有小于等于100的质数
n = 10000000000000
primes = find_primes_up_to(n)
print(f"小于等于{n}的质数有: {primes}")
